// SetIpPort.cpp : implementation file
//

#include "stdafx.h"
#include "client.h"
#include "SetIpPort.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSetIpPort dialog


CSetIpPort::CSetIpPort(IP_INFO *pIpInfo, CWnd* pParent /*=NULL*/)
	: CDialog(CSetIpPort::IDD, pParent)
{
	m_pIpInfo = pIpInfo;
}

void CSetIpPort::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetIpPort)
	DDX_Control(pDX, IDC_IPADDRESS, m_ipAddr);
	DDX_Text(pDX, IDC_EDIT_PORT, m_uiPort);
	DDV_MinMaxUInt(pDX, m_uiPort, 1025, 65535);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetIpPort, CDialog)
	//{{AFX_MSG_MAP(CSetIpPort)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetIpPort message handlers

BOOL CSetIpPort::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_ipAddr.SetAddress(m_pIpInfo->dIpAdd);
	m_uiPort = m_pIpInfo->uiPort;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetIpPort::OnOK() 
{
	UpdateData(TRUE);

	m_ipAddr.GetAddress(m_pIpInfo->dIpAdd);
	m_pIpInfo->uiPort = m_uiPort;
	CDialog::OnOK();
}
